home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Winc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  3.6 KB  |  124 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __WINC_H
  7. #define __WINC_H 1
  8.  
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. #include <windows.h>
  14.  
  15. #ifdef __SC__
  16.  
  17. typedef unsigned short (* __pascal Hook_t)(char __far *,unsigned short,unsigned short);
  18. extern int winc_startmode;
  19. typedef struct TSTDIO
  20.   {
  21.   unsigned short    X;
  22.   unsigned short    Y;
  23.   HWND        HWnd;
  24.   HWND        PrevHWnd;
  25.   HDC        HDc;
  26.   unsigned short    TextXSize;
  27.   unsigned short    TextYSize;
  28.   POINT        Size;
  29.   POINT        Scroll;
  30.   HBRUSH    SolidBrush;
  31.   HFONT        Font;
  32.   RECT        ClientRect;
  33.   RECT        BottomLineRect;
  34.   Hook_t    HookFunction;
  35.   }
  36. StdIO_t;
  37.  
  38. #define TAB_FLG 2
  39. #define RET_FLG 1
  40.  
  41. #define StdOutSet(A)     StdIOSet(&StdOutW,A)
  42. #define StdErrSet(A)     StdIOSet(&StdErrW,A)
  43. #define StdOutGet()      StdIOGet(&StdOutW)
  44. #define StdErrGet()      StdIOGet(&StdErrW)
  45. #define StdOutRelease()  StdIORelease(&StdOutW)
  46. #define StdErrRelease()  StdIORelease(&StdErrW)
  47. #define StdOutHookSet(A) StdIOHook(&StdOutW,A)
  48. #define StdErrHookSet(A) StdIOHook(&StdErrW,A)
  49. #define StdOutHookGet()  StdIOHook(&StdOutW)
  50. #define StdErrHookGet()  StdIOHook(&StdErrW)
  51. #define StdOutClear()    StdIOClear(&StdOutW)
  52. #define StdErrClear()    StdIOClear(&StdErrW)
  53. #define StdOutFontSet(A)  StdIOFontSet(StdOutW,A)
  54. #define StdErrFontSet(A)  StdIOFontSet(StdErrW,A)
  55. #define StdOutFontGet(A)  StdIOFontGet(StdOutW)
  56. #define StdErrFontGet(A)  StdIOFontGet(StdErrW)
  57.  
  58. #ifndef NOMSG
  59. void   __pascal MessageFatalError(char __far *);
  60. void   __pascal MessageLoop(MSG __far *);
  61. #endif
  62.  
  63. #ifdef __cplusplus
  64.  
  65. void   __pascal StdIOSet(class StdIOC *,HWND);
  66. unsigned short __pascal StdIOGet(class StdIOC *);
  67. void   __pascal StdIORelease(class StdIOC *);
  68. void   __pascal StdIOHookSet(class StdIOC *,Hook_t);
  69. Hook_t __pascal StdIOHookGet(class StdIOC *);
  70. void   __pascal StdIOClear(class StdIOC *);
  71. void   __pascal StdIOFontSet(class StdIOC *, HFONT);
  72. HFONT  __pascal StdIOFontGet(class StdIOC *);
  73.  
  74. class StdIOC
  75.   {
  76.   protected:
  77.  StdIO_t   h;
  78.  
  79.   public:
  80.     void       Set(HWND x)        { StdIOSet(this,x); }
  81.   unsigned short   Get(void)          { return StdIOGet(this); }
  82.     void       Release(void)      { StdIORelease(this); }      
  83.     void       HookSet(Hook_t x)  { StdIOHookSet(this,x); }
  84.   Hook_t       HookGet(void)      { return StdIOHookGet(this); }
  85.   unsigned short   LineCountGet(void) { return h.Size.y/h.TextYSize; }
  86.     void       CursorSet(unsigned short x,unsigned short y) { h.X = x; h.Y = y; }
  87.     void       FontSet(HFONT f)   { StdIOFontSet(this,f); }
  88.   HBRUSH       BrushBackGroundGet(void)     { return h.SolidBrush; }
  89.     RECT      *ClientRectGet(void)          { return &h.ClientRect; }
  90.     RECT      *BottomLineRectGet(void)      { return &h.BottomLineRect; }
  91.     HWND       WndGet(void)       { return h.HWnd; }
  92.    HFONT       FontGet(void)      { return h.Font; }
  93.   unsigned short   TextXGet(void)     { return h.TextXSize; }
  94.   unsigned short   TextYGet(void)     { return h.TextYSize; }
  95.   unsigned short   SizeYGet(void)     { return h.Size.y; }
  96.     void       Clear(void)        { StdIOClear(this); }
  97.   };
  98.  
  99. extern StdIOC   StdOutW;
  100. extern StdIOC   StdErrW;
  101.  
  102. #else
  103.  
  104. void   __pascal StdIOSet(StdIO_t *,HWND);
  105. unsigned short __pascal StdIOGet(StdIO_t *);
  106. void   __pascal StdIORelease(StdIO_t *);
  107. void   __pascal StdIOHookSet(StdIO_t *,Hook_t);
  108. Hook_t __pascal StdIOHookGet(StdIO_t *);
  109. void   __pascal StdIOClear(StdIO_t *);
  110. void   __pascal StdIOFontSet(StdIO_t *, HFONT);
  111. HFONT  __pascal StdIOFontGet(StdIO_t *);
  112.  
  113. extern StdIO_t   StdOutW;
  114. extern StdIO_t   StdErrW;
  115.  
  116. #endif  /* cplusplus */
  117. #endif  /* _SC_ */
  118.  
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122.  
  123. #endif
  124.